package com.slipper.common.excel.parse.support;

import com.slipper.common.excel.ExcelColumn;
import org.apache.poi.ss.usermodel.Cell;

import java.math.BigDecimal;

public class BigDecimalParse extends CellParse {
    @Override
    public Object parse(Cell cell, ExcelColumn column) throws Exception {
        String value = super.parserCellValue(cell, column);
        if (value == null || value.isEmpty()) {
            return null;
        }

        try {
            return new BigDecimal(value);
        } catch (Exception e) {
            throw new Exception("数字格式错误！");
        }
    }
}
